package com.example.administrator.shzs.utils;

import android.content.Context;
import android.view.View;
import android.widget.ImageView;

import com.bigkoo.convenientbanner.holder.Holder;
import com.example.administrator.shzs.entity.IndexCarousel;
import com.example.administrator.shzs.R;
import com.squareup.picasso.Picasso;

/**
 * Created by Sai on 15/8/4.
 *  首页 轮播图 网络图片加载例子
 */
public class NetworkImageHolderView implements Holder<IndexCarousel> {
    private ImageView imageView;
    @Override
    public View createView(Context context) {
        imageView = new ImageView(context);
        imageView.setScaleType(ImageView.ScaleType.FIT_XY);

        return imageView;
    }

    @Override
    public void UpdateUI(Context context, int position, IndexCarousel data) {
            Picasso.with(context).load(data.getSortName()).placeholder(R.mipmap.loding).error(R.mipmap.loding).into(imageView);
    }
}
